<template >
    <div class="orders">
<!-- 面包屑 -->
        <el-breadcrumb separator="/" class="mb">
      <el-breadcrumb-item :to="{ path: '/welcome' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>
        <a>订单管理</a>
      </el-breadcrumb-item>
      <el-breadcrumb-item>订单列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片 -->
    <el-card class="box-card">
      <!-- 添加分类 -->
       <el-input v-model="queryInfo.query" @keydown.enter="chaHandel" placeholder="请输入内容">
          <el-button @click="chaHandel" slot="append" icon="el-icon-search"></el-button>
        </el-input>
      <!-- 数据表格 -->
      <el-table border :data="tableData" style="width: 100%">
        <el-table-column type="index" label="#" width="180"></el-table-column>
        <el-table-column prop="order_number" label="订单编号" width="180"></el-table-column>
        <el-table-column prop="order_price" label="订单价格"></el-table-column>
        <el-table-column prop="address" label="是否付款">
              <template slot-scope="scope">
            <el-button
            v-if="scope.row.pay_status==0"
              size="mini"
              :type="tagType[scope.row.pay_status]"
            >未付款</el-button>
              <el-button
            v-if="scope.row.pay_status==1"
              size="mini"
              :type="tagType[scope.row.pay_status]"
            >已付款</el-button>

          </template>
        </el-table-column>
        <el-table-column prop="is_send" label="是否发货"></el-table-column>
        <el-table-column prop="address" label="下单时间">
             <template slot-scope="scope">
          <div>
            {{scope.row.create_time}}
          </div>
        </template>
        </el-table-column>
        <el-table-column prop="address" label="操作">
 <template slot-scope="scope">
            <div>
              <el-tooltip
                class="item"
                effect="dark"
                content="修改订单地址"
                placement="top-start"
              >
                <el-button size="mini"
                type="primary"
                icon="el-icon-edit"
                @click="showEditDia"
                ></el-button>
              </el-tooltip>
             
              <el-tooltip
                class="item"
                effect="dark"
                content="物流信息"
                placement="top-start"
              >
                <el-button size="mini"
                type="success"
                icon="el-icon-location-outline"
                @click="showTimeLineDia"
                ></el-button>
              </el-tooltip>
            </div>
          </template>
        </el-table-column>
      </el-table>


      <div class="block">

    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="queryInfo.pagenum"
      :page-sizes="[3, 5, 10]"
      :page-size="1"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
  </div>
    </el-card>
    </div>
</template>

<script>
    export default {
        
    


        data() {
            return {
                tagType: ["primary", "danger"],
                 tableData: [],
                 total:'',
                 queryInfo:{
                     query:'',
                     pagenum:1,
                     pagesize:3
                 }
            }
        },
         methods: {
             chaHandel(){
                 this.getlist()
             },
            //  物流信息
            showTimeLineDia(){

            },         
            //  分页
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
              this.queryInfo.pagesize = val;
this.getlist()
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      this.queryInfo.pagenum = val;
this.getlist()
      },
      getlist(){
          this.$axios.get("/orders", { params: this.queryInfo }).then(res=>{
this.tableData=res.data.data.goods
this.total=res.data.data.total
              console.log('订单列表',this.total);
              
          })
      }
    },
    mounted(){
        this.getlist()
    }
    }
</script>

<style lang="scss" scoped>
.mb {
  margin-bottom: 20px;
}
.el-input {
  width: 300px;
}
</style>